class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        //双指针
        size_t size = nums.size();
        if(!size)
            return 0;
        int fast, slow;
        fast = slow = 1;
        while(fast < size){
            if(nums[fast] != nums[fast - 1]){
                nums[slow] = nums[fast];
                ++slow;
            }
        ++fast;
        }
        return slow;
    }
};